// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import axios from "axios";
import ElementUI from 'element-ui'

import 'element-ui/lib/theme-chalk/index.css'
Vue.use(ElementUI)
Vue.config.productionTip = false
Vue.prototype.$axios = axios
/* eslint-disable no-new */

axios.interceptors.request.use(config => {
  console.log("=====拦截请求=====")
  if (sessionStorage.getItem("token")) {
    config.headers['Authorization'] = sessionStorage.getItem("token");
  }
  return config;
}, error => {
  return Promise.reject(error)
})
/*axios.interceptors.response.use(config => {
  console.log("========拦截响应=========")
  if (config.code.code == 801) {
    location.href = "/";
  }
  return r;
}, error => {
  return Promise.reject(error);
})*/


new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>'
})
